﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace RainingNight
{
    class Timer
    {
        private float m_DeltaTime;
        private float m_Time;

        public Timer()
        {
            DeltaTime = 0f;
            Time = 0f;

        }

        public void TimeReset(GameTime gametime)
        {
            DeltaTime = 0f;
        }

        public void TimeRun(GameTime gametime)
        {
            DeltaTime += (float)gametime.ElapsedGameTime.TotalMilliseconds;
            Time += (float)gametime.ElapsedGameTime.TotalMilliseconds;
        }

        public bool StopWatch(float ms, GameTime gametime)
        {
            if (DeltaTime > ms)
            {
                TimeReset(gametime);
                return true;
            }
            return false;
        }

        public float DeltaTime
        {
            get { return m_DeltaTime; }
            private set { m_DeltaTime = value; }
        }

        public float Time
        {
            get { return m_Time; }
            private set { m_Time = value; }
        }
    }
}
